import { http } from '@/utils/http'
import type { BannerItem, CategoryItem, GuessYouLikeItem, HotPanelItem } from '@/types/home'
import type { PageData, PageParams } from '@/types/global'
/**
 * 获取首页轮播图
 * @param distributionSite 1: 首页轮播图 2: 分类页轮播图
 */

export function getHomeBanner(distributionSite = 1) {
  // 返回值类型为 Promise<BannerItem[]>
  return http<BannerItem[]>({
    url: '/home/banner',
    method: 'GET',
    data: {
      distributionSite,
    },
  })
}

// 首页分类获取
export function getHomeCategory() {
  return http<CategoryItem[]>({
    url: '/home/category/mutli',
    method: 'GET',
  })
}

// 首页热门推荐获取
export function getHomeHotPanel() {
  return http<HotPanelItem[]>({
    url: '/home/hot/mutli',
    method: 'GET',
  })
}

// 首页猜你喜欢获取
export function getHomeGuessYouLike(data?: PageParams) {
  return http<PageData<GuessYouLikeItem[]>>({
    url: '/home/goods/guessLike',
    method: 'GET',
    data,
  })
}
